import DataManager from "./DataManager";

const { ccclass, property } = cc._decorator;

@ccclass
export default class LevelCell extends cc.Component {

    @property(cc.Label)
    labName: cc.Label = null;

    m_key: string = '';

    onLoad() { }

    start() {

    }

    public initCell(key: string, levelName: string) {
        this.m_key = key;
        this.labName.string = levelName;
    }

    private onBtnClick(event: cc.Event, data: string) {
        if (event.type === cc.Node.EventType.TOUCH_END) {
            cc.log('m_key = ' + this.m_key);
            DataManager.getIns().setCurrentLevel(this.m_key);
            cc.director.loadScene('GameScene');
        }
    }
}
